package com.cy.pj.module.controller;

import com.cy.pj.module.pojo.RequestParameter;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.Map;

@RestController
public class ParamObjectController {

    @RequestMapping("/doParamObject01")
    public String doParamObject01(String name,
                                  @DateTimeFormat(pattern = "yyyy/MM/dd")
                                  @RequestParam Date startDate){
        return "request param is:"+name+"/startDate:"+startDate;

    }


    @RequestMapping("/doParamObject02/{id}/{b}")
    public String doParamObject02(@PathVariable Integer id, @PathVariable String b){
        return "request param is:"+id+"/String:"+b;

    }

    @RequestMapping("/doParamObject03/{name}")
    public String doParamObject03(RequestParameter pojo){
        return "request param is:"+pojo.toString();
    }

    @RequestMapping("/doParamObject04")
    public String doParamObject04(RequestParameter pojo){
        return "request param is:"+pojo;
    }


    @RequestMapping("/doParamObject05")
    public String doParamObject05(@RequestParam Map<String,Object> map){
        return "request param is:"+map;
    }

    @RequestMapping("/doParamObject06/{name}")
    public String doParamObject06(@PathVariable Map<String,Object> map){
        return "request param is:"+map;
    }

}
